Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Review ResponseStatus usage #101

Merged
merged 1 commit into from
Feb 6, 2020

Conversation

hug-dev
Copy link
Member

@hug-dev hug-dev commented Feb 6, 2020

Adds a mapping between PKCS 11 and TSS error codes with our
ResponseStatus.
Adds a conversion between String and ResponseStatus in the Key ID
Manager.

Signed-off-by: Hugues de Valon hugues.devalon@arm.com

Close #77
Close #72

Adds a mapping between PKCS 11 and TSS error codes with our
ResponseStatus.
Adds a conversion between String and ResponseStatus in the Key ID
Manager.

Signed-off-by: Hugues de Valon <hugues.devalon@arm.com>
@hug-dev hug-dev self-assigned this Feb 6, 2020
@hug-dev hug-dev added bug Something isn't working invalid This doesn't seem right labels Feb 6, 2020
@hug-dev hug-dev added this to the Parsec production ready milestone Feb 6, 2020
Copy link
Member

@ionut-arm ionut-arm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice to see we're actually returning consistent error codes for all providers now!! Not sure if we want to documenta all of it (in official documentation) so that people used to, say, PKCS11 can figure out what might've caused smth.

src/key_id_managers/mod.rs Show resolved Hide resolved
src/providers/mbed_provider/mod.rs Show resolved Hide resolved
let psa_status = psa_status.checked_add(PSA_STATUS_TO_RESPONSE_STATUS_OFFSET)?;
let psa_status = u16::try_from(psa_status).ok()?;
Some(psa_status.try_into().ok()?)
let psa_status = match psa_status.checked_abs() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.checked_abs().ok_or(ResponseStatus::InvalidEncoding)? - does this work? Same for the ones below

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried something like that but it does not unfortunately! The reason is that the function returns ResponseStatus and not Option<ResponseStatus>

src/providers/pkcs11_provider/utils.rs Show resolved Hide resolved
src/providers/tpm_provider/utils.rs Show resolved Hide resolved
Copy link
Member

@ionut-arm ionut-arm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, everything looks fine!

@hug-dev hug-dev merged commit d6870a5 into parallaxsecond:master Feb 6, 2020
@hug-dev hug-dev deleted the fix-response-status branch February 6, 2020 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working invalid This doesn't seem right
Projects
None yet
2 participants